import request from '@/utils/request'
import type {
  patientMedicineOrderPreReq,
  patientMedicineOrderPreApi,
  patientOrderAddressItem,
  patientMedicineOrderReq,
  patientMedicineOrderDetailApi,
  patientMockConsignmentApi
} from '@/types/order'
// 药品订单-支付药款页面-根据处方信息计算药款
//consult-api.itheima.net/patient/medicine/order/pre
export const patientMedicineOrderPre = (data: patientMedicineOrderPreReq) =>
  request<patientMedicineOrderPreApi>('/patient/medicine/order/pre', 'get', data)
// 订单-查询收货地址列表
export const patientOrderAddress = () =>
  request<patientOrderAddressItem[]>('/patient/order/address')

//   药品订单-根据处方下药品订单
export const patientMedicineOrder = (data: patientMedicineOrderReq) =>
  request<{ id: string }>('/patient/medicine/order', 'post', data)

//   药品订单-查询订单详情信息
export const patientMedicineOrderDetail = (id: string) =>
  request<patientMedicineOrderDetailApi>(`/patient/medicine/order/detail/${id}`)

// 订单-模拟发货信息-生成物流信息
export const patientMockConsignment = (id: string) =>
  request<patientMockConsignmentApi>(`/patient/order/${id}/logistics`)
